package lock;

import org.openjdk.jol.datamodel.X86_32_DataModel;
import org.openjdk.jol.datamodel.X86_64_COOPS_DataModel;
import org.openjdk.jol.datamodel.X86_64_DataModel;
import org.openjdk.jol.info.ClassLayout;
import org.openjdk.jol.layouters.HotSpotLayouter;
import org.openjdk.jol.layouters.Layouter;

/**
 * @author: feiwang_6
 * @create: 2020/5/10 17:36
 * @description:
 */
public class MainTest {
    public static void main(String[] args) {
        Layouter l;

        //当前vm对象分布(64位vm,未启动指针压缩)
        /*l = new CurrentLayouter();
        System.out.println("*****  " + l);
        System.out.println(ClassLayout.parseClass(MyObject.class, l).toPrintable());*/
        
        //32位vm对象分布
        l = new HotSpotLayouter(new X86_32_DataModel());
        System.out.println("***** " + l);
        System.out.println(ClassLayout.parseClass(MyObject.class, l).toPrintable());
        System.out.println("=====================================================");
        //64位vm对象分布,未启动指针压缩
        l = new HotSpotLayouter(new X86_64_DataModel());
        System.out.println("***** " + l);
        System.out.println(ClassLayout.parseClass(MyObject.class, l).toPrintable());

        //64位vm对象分布,启动指针压缩
        l = new HotSpotLayouter(new X86_64_COOPS_DataModel());
        System.out.println("***** " + l);
        System.out.println(ClassLayout.parseClass(MyObject.class, l).toPrintable());
    }
}
